package com.frogs.ucenter.v1.request;

import javax.servlet.http.HttpServletRequest;

import com.frogs.framework.util.StringUtil;
import com.frogs.framework.web.HttpRequestInfo;
import com.frogs.system.util.ApiUrlParamEnum;
import com.frogs.system.util.ApplicablePlatformEnum;
import com.frogs.system.web.api.request.Request;
import com.frogs.system.web.exception.RequestIllegalException;

public class DirectMessageListRequest extends Request {
	
	private static final long serialVersionUID = 7879502263396718159L;

	private String receiverId;
	
	private Integer status;
	
	private Integer applicableId;
	
	private Integer pageNo;
	
	private Integer pageSize;
	
	private String level;
	
	/** */
	public DirectMessageListRequest() {
	}
	
	@Override
	public void parse(HttpServletRequest request) {
		HttpRequestInfo requestInfo = new HttpRequestInfo(request);
	
		this.applicableId = requestInfo.getIntAttribute(ApiUrlParamEnum.applicablePlatformId.getParamName(), ApplicablePlatformEnum.WEB.getId());
		this.status = requestInfo.getIntParameter(ApiUrlParamEnum.status.getParamName(), -1);
		this.receiverId = requestInfo.getParameter(ApiUrlParamEnum.receiverIds.getParamName());
		this.level = requestInfo.getParameter(ApiUrlParamEnum.level.getParamName());
		
		this.pageNo = requestInfo.getIntParameter(ApiUrlParamEnum.pageNo.getParamName(), 0);
		this.pageSize = requestInfo.getIntParameter(ApiUrlParamEnum.pageSize.getParamName(), 20);
		
		if(StringUtil.isEmpty(receiverId)) {
			throw new RequestIllegalException("收件人ID不能为空");
		}

	}

	public String getReceiverId() {
		return receiverId;
	}

	public void setReceiverId(String receiverId) {
		this.receiverId = receiverId;
	}

	public Integer getStatus() {
		return status;
	}

	public void setStatus(Integer status) {
		this.status = status;
	}

	public Integer getApplicableId() {
		return applicableId;
	}

	public void setApplicableId(Integer applicableId) {
		this.applicableId = applicableId;
	}

	public Integer getPageNo() {
		return pageNo;
	}

	public void setPageNo(Integer pageNo) {
		this.pageNo = pageNo;
	}

	public Integer getPageSize() {
		return pageSize;
	}

	public void setPageSize(Integer pageSize) {
		this.pageSize = pageSize;
	}

	public String getLevel() {
		return level;
	}

	public void setLevel(String level) {
		this.level = level;
	}

}
